<% layout('/layouts/default.html', {title: '仓库档案查询', libs: ['validate','fileupload','dataGrid']}){ %>
<div class="main-content">
	<div class="box box-main">
		<div class="box-header with-border">
			<div class="box-title">
				<i class="fa icon-note"></i> ${text('仓库档案详情')}
                <% if (hasPermi('base:warehouse:twarehouse:edit')){ %>
                <button type="button" class="btn btn-primary" id="editView">${text('编辑单据')}</button>
                <% } %>
			</div>
			<div class="box-tools pull-right">
				<button type="button" class="btn btn-box-tool" data-widget="collapse"><i class="fa fa-minus"></i></button>
			</div>
		</div>
		<#form:form id="inputForm" model="${twarehouse}" action="${ctx}/base/warehouse/twarehouse/save" method="post" class="form-horizontal">
			<div class="box-body">
				<div class="form-unit">${text('基本信息')}</div>
				<div class="row">
					<div class="col-xs-6">
						<div class="form-group">
							<label class="control-label col-sm-4" title="">
								<span class="required ">*</span> ${text('仓库编号')}：<i class="fa icon-question hide"></i></label>
							<div class="col-sm-8">
								<#form:hidden path="isNewRecord"/>
							<#form:input path="warehouseId" maxlength="64" readonly="true" class="form-control required abc" disabled="true"/>
							</div>
						</div>
					</div>
					<div class="col-xs-6">
						<div class="form-group">
							<label class="control-label col-sm-4" title="">
								<span class="required hide">*</span> ${text('仓库名称')}：<i class="fa icon-question hide"></i></label>
							<div class="col-sm-8">
								<#form:input path="warehouseName" maxlength="100" class="form-control" disabled="true"/>
							</div>
						</div>
					</div>
					<div class="col-xs-6">
						<div class="form-group">
							<label class="control-label col-sm-4" title="">
								<span class="required hide">*</span> ${text('仓库地址')}：<i class="fa icon-question hide"></i></label>
							<div class="col-sm-8">
								<#form:input path="address" maxlength="200" class="form-control" disabled="true"/>
							</div>
						</div>
					</div>
					<div class="col-xs-6">
						<div class="form-group">
							<label class="control-label col-sm-4" title="">
								<span class="required hide">*</span> ${text('仓库面积')}：<i class="fa icon-question hide"></i></label>
							<div class="col-sm-8">
								<#form:input path="acreage" maxlength="100" class="form-control" disabled="true"/>
							</div>
						</div>
					</div>
					<div class="col-xs-6">
						<div class="form-group">
							<label class="control-label col-sm-4" title="">
								<span class="required hide">*</span> ${text('区域')}：<i class="fa icon-question hide"></i></label>
							<div class="col-sm-8">
								<#form:select path="area" dictType="car_quyu" blankOption="true" class="form-control" disabled="true"/>
							</div>
						</div>
					</div>
					<div class="col-xs-6">
						<div class="form-group">
							<label class="control-label col-sm-4" title="">
								<span class="required hide">*</span> ${text('海外仓服务商')}：<i class="fa icon-question hide"></i></label>
							<div class="col-sm-8">
								<#form:select path="serviceProvider" items="${listSupplierFWS}"
								itemLabel="supplierName" itemValue="supplierId" blankOption="true" class="form-control"  disabled="true"/>
							</div>
						</div>
					</div>
					<div class="col-xs-6">
						<div class="form-group">
							<label class="control-label col-sm-4" title="">
								<span class="required hide">*</span> ${text('仓库归属')}：<i class="fa icon-question hide"></i></label>
							<div class="col-sm-8">
								<#form:select path="ownership" dictType="warehouse_guishu" blankOption="true" class="form-control" disabled="true"/>
							</div>
						</div>
					</div>
					<div class="col-xs-6">
						<div class="form-group">
							<label class="control-label col-sm-4" title="">
								<span class="required hide">*</span> ${text('仓库性质')}：<i class="fa icon-question hide"></i></label>
							<div class="col-sm-8">
								<#form:select path="property" dictType="warehouse_xingzhi" blankOption="true" class="form-control" disabled="true"/>
							</div>
						</div>
					</div>
					<div class="col-xs-6">
						<div class="form-group">
							<label class="control-label col-sm-4" title="">
								<span class="required hide">*</span> ${text('所属资方')}：<i class="fa icon-question hide"></i></label>
							<div class="col-sm-8">
								<#form:select path="investor" items="${listSupplierZF}"
								itemLabel="supplierName" itemValue="supplierId" blankOption="true" class="form-control" disabled="true"/>
							</div>
						</div>
					</div>
					<div class="col-xs-6">
						<div class="form-group">
							<label class="control-label col-sm-4" title="">
								<span class="required hide">*</span> ${text('所属客户')}：<i class="fa icon-question hide"></i></label>
							<div class="col-sm-8">
								<#form:select path="customer" items="${listCustomer}"
								itemLabel="customerName" itemValue="customerId" blankOption="true" class="form-control" disabled="true"/>
							</div>
						</div>
					</div>
				</div>
				<div class="row">
					<div class="col-xs-12">
						<div class="form-group">
							<label class="control-label col-sm-2" title="">
								<span class="required hide">*</span> ${text('备注')}：<i class="fa icon-question hide"></i></label>
							<div class="col-sm-10">
								<#form:textarea path="remarks" rows="4" maxlength="500" class="form-control" disabled="true"/>
							</div>
						</div>
					</div>
				</div>
                <div class="form-unit">${text('联系人信息')}</div>
				<div class="row">
					<div class="col-xs-6">
						<div class="form-group">
							<label class="control-label col-sm-4" title="">
								<span class="required hide">*</span> ${text('联系人')}：<i class="fa icon-question hide"></i></label>
							<div class="col-sm-8">
								<#form:input path="contact" maxlength="100" class="form-control" disabled="true"/>
							</div>
						</div>
					</div>
					<div class="col-xs-6">
						<div class="form-group">
							<label class="control-label col-sm-4" title="">
								<span class="required hide">*</span> ${text('联系电话')}：<i class="fa icon-question hide"></i></label>
							<div class="col-sm-8">
								<#form:input path="phone" maxlength="100" class="form-control" disabled="true"/>
							</div>
						</div>
					</div>
					<div class="col-xs-6">
						<div class="form-group">
							<label class="control-label col-sm-4" title="">
								<span class="required hide">*</span> ${text('微信')}：<i class="fa icon-question hide"></i></label>
							<div class="col-sm-8">
								<#form:input path="wechat" maxlength="100" class="form-control" disabled="true"/>
							</div>
						</div>
					</div>
					<div class="col-xs-6">
						<div class="form-group">
							<label class="control-label col-sm-4" title="">
								<span class="required hide">*</span> ${text('邮箱')}：<i class="fa icon-question hide"></i></label>
							<div class="col-sm-8">
								<#form:input path="email" maxlength="100" class="form-control" disabled="true"/>
							</div>
						</div>
					</div>
                    <div class="form-unit">${text('保险信息')}</div>
					<div class="col-xs-6">
						<div class="form-group">
							<label class="control-label col-sm-4" title="">
								<span class="required hide">*</span> ${text('保险公司')}：<i class="fa icon-question hide"></i></label>
							<div class="col-sm-8">
								<#form:input path="insuranceCompany" maxlength="100" class="form-control" disabled="true"/>
							</div>
						</div>
					</div>
					<div class="col-xs-6">
						<div class="form-group">
							<label class="control-label col-sm-4" title="">
								<span class="required hide">*</span> ${text('保险信息')}：<i class="fa icon-question hide"></i></label>
							<div class="col-sm-8">
								<#form:input path="insuranceInformation" maxlength="100" class="form-control" disabled="true"/>
							</div>
						</div>
					</div>
                    <div class="form-unit">${text('报价信息')}</div>
                    <div class="ml10 mr10">
                        <table id="twarehouseChargeItemsDataGrid"></table>
                    </div>
					<div class="col-xs-12">
						<div class="form-group">
							<label class="control-label col-sm-3" title="">
								<span class="required hide">*</span> ${text('TOTAL LOADING CHARGES( Currency Type 1 )')}：<i class="fa icon-question hide"></i></label>
							<div class="col-sm-9">
								<#form:input path="totalLoadingCharges1" class="form-control number" disabled="true"/>
							</div>
						</div>
					</div>
					<div class="col-xs-12">
						<div class="form-group">
							<label class="control-label col-sm-3" title="">
								<span class="required hide">*</span> ${text('TOTAL LOADING CHARGES( Currency Type 2 ')}：<i class="fa icon-question hide"></i></label>
							<div class="col-sm-9">
								<#form:input path="totalLoadingCharges2" class="form-control number" disabled="true"/>
							</div>
						</div>
					</div>
                    <div class="form-unit">${text('其他费用项')}</div>
                    <div class="ml10 mr10">
                        <table id="twarehouseOtherChargeItemsDataGrid"></table>
                    </div>
                    <div class="form-unit">${text('费用说明')}</div>
					<div class="col-xs-12">
						<div class="form-group">
							<label class="control-label col-sm-2" title="">
								<span class="required hide">*</span> ${text('Trucking charges')}：<i class="fa icon-question hide"></i></label>
							<div class="col-sm-10">
								<#form:input path="truckingCharges" maxlength="500" class="form-control" disabled="true"/>
							</div>
						</div>
					</div>
					<div class="col-xs-12">
						<div class="form-group">
							<label class="control-label col-sm-2" title="">
								<span class="required hide">*</span> ${text('Offer inculdes')}：<i class="fa icon-question hide"></i></label>
							<div class="col-sm-10">
								<#form:input path="offerInculdes" maxlength="500" class="form-control" disabled="true"/>
							</div>
						</div>
					</div>
					<div class="col-xs-12">
						<div class="form-group">
							<label class="control-label col-sm-2" title="">
								<span class="required hide">*</span> ${text('Offer excludes')}：<i class="fa icon-question hide"></i></label>
							<div class="col-sm-10">
								<#form:input path="offerExcludes" maxlength="500" class="form-control" disabled="true"/>
							</div>
						</div>
					</div>
				</div>
                <div class="form-unit">${text('附件上传')}</div>
				<div class="row">
					<div class="col-xs-12">
						<div class="form-group">
							<label class="control-label col-sm-2">
								<span class="required hide">*</span> ${text('附件上传')}：</label>
							<div class="col-sm-10">
								<#form:fileupload id="uploadFile" bizKey="${twarehouse.id}" bizType="twarehouse_file"
									uploadType="all" class="" readonly="true" preview="true"/>
							</div>
						</div>
					</div>
				</div>
                <div class="form-unit">${text('系统信息')}</div>
                <div class="row">
                    <div class="col-xs-6">
                        <div class="form-group">
                            <label class="control-label col-sm-4" title="">
                                <span class="required hide">*</span> ${text('创建日期')}：<i class="fa icon-question hide"></i></label>
                            <div class="col-sm-8">
                                <#form:input path="createDate" class="form-control" disabled="true"
                                dataFormat="datetime2" data-type="datetime" data-format="yyyy-MM-dd HH:mm:ss"/>
                            </div>
                        </div>
                    </div>
                    <div class="col-xs-6">
                        <div class="form-group">
                            <label class="control-label col-sm-4" title="">
                                <span class="required hide">*</span> ${text('创建人')}：<i class="fa icon-question hide"></i></label>
                            <div class="col-sm-8">
                                <!--<#form:input path="createBy" class="form-control" disabled="true"/>-->
                                <#form:select path="createBy" items="${listUser}" disabled="true"
                                itemLabel="userName" itemValue="userCode"  blankOption="true" class="form-control"/>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="row">
                    <div class="col-xs-6">
                        <div class="form-group">
                            <label class="control-label col-sm-4" title="">
                                <span class="required hide">*</span> ${text('最后修改日期')}：<i class="fa icon-question hide"></i></label>
                            <div class="col-sm-8">
                                <#form:input path="updateDate" readonly="true" maxlength="20" class="form-control"
                                dataFormat="datetime2" data-type="datetime" data-format="yyyy-MM-dd HH:mm:ss"/>
                            </div>
                        </div>
                    </div>
                    <div class="col-xs-6">
                        <div class="form-group">
                            <label class="control-label col-sm-4" title="">
                                <span class="required hide">*</span> ${text('最后修改人')}：<i class="fa icon-question hide"></i></label>
                            <div class="col-sm-8">
                                <!--<#form:input path="updateBy" readonly="true" maxlength="20" class="form-control"/>-->
                                <#form:select path="updateBy" items="${listUser}" disabled="true"
                                itemLabel="userName" itemValue="userCode"  blankOption="true" class="form-control"/>
                            </div>
                        </div>
                    </div>
                </div>

            </div>
			<div class="box-footer">
				<div class="row">
					<div class="col-sm-offset-2 col-sm-10">
						<button type="button" class="btn btn-sm btn-default" id="btnCancel" onclick="js.closeCurrentTabPage()"><i class="fa fa-reply-all"></i> ${text('关 闭')}</button>
						</div>
				</div>
			</div>
		</#form:form>
	</div>
</div>
<% } %>
<script>
//初始化其他费用项DataGrid对象
$("#twarehouseOtherChargeItemsDataGrid").dataGrid({
	data: ${toJson(twarehouse.twarehouseOtherChargeItemsList)},
	datatype: "local", // 设置本地数据
	autoGridHeight: function(){return 'auto'}, // 设置自动高度
	
	// 设置数据表格列
	columnModel: [
		{header:'状态', name:'status', editable:true, hidden:true},
		{header:'主键', name:'chargeItemsId', editable:true, hidden:true},
		{header:'${text("Charge Items 费用项")}', name:'chargeItems', index:'a.chargeItems', width:150, align:"center", formatter: function(val, obj, row, act){
				return js.getDictLabel(${@DictUtils.getDictListJson('warehouse_feiyong')}, val, '${text("未知")}', true);
			}}		,
		{header:'${text("Currency Type 币种")}', name:'currencyType', index:'a.currencyType', width:100, align:"center", formatter: function(val, obj, row, act){
				return js.getDictLabel(${@DictUtils.getDictListJson('sys_bizhong')}, val, '${text("未知")}', true);
			}}	,
		{header:'${text("Unit-price 单价")}', name:'unitPrice', width:80, editable:true, edittype:'text', align:"center",editoptions:{'class':'form-control number'}},
		{header:'${text("Unit 单位")}', name:'unit', width:80, editable:true, edittype:'text',align:"center", editoptions:{'maxlength':'100', 'class':'form-control'}},
		{header:'${text("Note 说明")}', name:'note', width:100, editable:true, edittype:'text', editoptions:{'maxlength':'100', 'class':'form-control'}},
		{header:'${text("仓库ID")}', name:'warehouseId.warehouseId', editable:true, hidden:true},
		{header:'${text("操作")}', name:'actions', hidden: true}
	],
	
	// 编辑表格参数
	editGrid: false,				// 是否是编辑表格
	editGridInitRowNum: 0,		// 编辑表格的初始化新增行数
	editGridAddRowBtn: $('#twarehouseOtherChargeItemsDataGridAddRowBtn'),	// 子表增行按钮
	editGridAddRowInitData: {chargeItemsId: '', status: Global.STATUS_NORMAL},	// 新增行的时候初始化的数据
	
	// 编辑表格的提交数据参数
	editGridInputFormListName: 'twarehouseOtherChargeItemsList', // 提交的数据列表名
	editGridInputFormListAttrs: 'status,chargeItemsId,chargeItems,currencyType,unitPrice,unit,note,warehouseId.warehouseId,', // 提交数据列表的属性字段
	
	// 加载成功后执行事件
	ajaxSuccess: function(data){
		
	}
});
//初始化费用项DataGrid对象
$("#twarehouseChargeItemsDataGrid").dataGrid({
	data: ${toJson(twarehouse.twarehouseChargeItemsList)},
	datatype: "local", // 设置本地数据
	autoGridHeight: function(){return 'auto'}, // 设置自动高度
	
	// 设置数据表格列
	columnModel: [
		{header:'状态', name:'status', editable:true, hidden:true},
		{header:'主键', name:'chargeItemsId', editable:true, hidden:true},
		{header:'${text("Charge Items 费用项")}', name:'chargeItems', width:150, editable:true, edittype:'text', align:"center",editoptions:{'maxlength':'2', 'class':'form-control'}},
		{header:'${text("Specification 规格")}', name:'specification', width:150, editable:true, edittype:'text', align:"center",editoptions:{'maxlength':'100', 'class':'form-control'}},
		{header:'${text("Currency Type 1 币种 1")}', name:'currencyType', index:'a.currencyType', width:100, align:"center", formatter: function(val, obj, row, act){
				return js.getDictLabel(${@DictUtils.getDictListJson('sys_bizhong')}, val, '${text("未知")}', true);
			}},
		{header:'${text("Amount 金额")}', name:'unitPrice', width:150, editable:true, edittype:'text', align:"center",editoptions:{'class':'form-control number'}},
		{header:'${text("Currency Type 2 币种 2")}', name:'currencyType2', index:'a.currencyType2', width:100, align:"center", formatter: function(val, obj, row, act){
				return js.getDictLabel(${@DictUtils.getDictListJson('sys_bizhong')}, val, '${text("未知")}', true);
			}},
		{header:'${text("Amount 金额")}', name:'amount2', width:150, editable:true, edittype:'text', align:"center",editoptions:{'class':'form-control number'}},
		{header:'${text("仓库ID")}', name:'warehouseId.warehouseId', editable:true, hidden:true},
		{header:'${text("操作")}', name:'actions', hidden: true}
	],
	
	// 编辑表格参数
	editGrid: false,				// 是否是编辑表格
	editGridInitRowNum: 0,		// 编辑表格的初始化新增行数
	editGridAddRowBtn: $('#twarehouseChargeItemsDataGridAddRowBtn'),	// 子表增行按钮
	editGridAddRowInitData: {chargeItemsId: '', status: Global.STATUS_NORMAL},	// 新增行的时候初始化的数据
	
	// 编辑表格的提交数据参数
	editGridInputFormListName: 'twarehouseChargeItemsList', // 提交的数据列表名
	editGridInputFormListAttrs: 'status,chargeItemsId,chargeItems,specification,currencyType,unitPrice,currencyType2,amount2,warehouseId.warehouseId,', // 提交数据列表的属性字段
	
	// 加载成功后执行事件
	ajaxSuccess: function(data){
		
	}
});
</script>
<script>
$("#inputForm").validate({
	submitHandler: function(form){
		js.ajaxSubmitForm($(form), function(data){
			js.showMessage(data.message);
			if(data.result == Global.TRUE){
				js.closeCurrentTabPage(function(contentWindow){
					contentWindow.page();
				});
			}
		}, "json");
    }
});
$("#editView").click(function () {
	var id = $("#warehouseId").val();
	var URL = '${ctx}/base/warehouse/twarehouse/form?warehouseId=' + id;
	window.location.href =URL;
});
</script>